#include <iostream>

using namespace std;

const int N = 1000005;

int cnt[N], r[N];

signed main()
{
    freopen("duel.in", "r", stdin);
    freopen("duel.out", "w", stdout);

    int n;
    scanf("%d", &n);
    for (int i = 1; i <= n; i++)
    {
        scanf("%d", &r[i]);
        cnt[r[i]]++;
    }

    int ans = 0;

    int last = 1;
    while (cnt[last] == 0) last++;

    int sum = 0, all = 0;
    for (int i = last + 1; i < N; i++)
    {
        if (cnt[i] == 0) continue;
        if (cnt[i] >= cnt[last])
        {
            int tmp = cnt[i] - cnt[last];
            cnt[last] = 0;
            last = i;
            if (sum >= tmp)
            {
                sum -= tmp;
                all += tmp;
            }
            else
            {
                all += sum;
                sum = 0;
            }

        }
        else
        {
            cnt[last] -= cnt[i];
            sum += cnt[last];
            last = i;
        }
    }

    for (int i = 1; i <= 1e5; i++) ans += cnt[i];

    printf("%d", ans - all);

    return 0;
}

